//
//  FDDetailHCellView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/24.
//  Copyright © 2019 SanYi. All rights reserved.
//
#define W 300
#import "FDDetailHCellView.h"

@implementation FDDetailHCellView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
        [self layout];
    }
    return self;
}
- (void)initSubView{
    [self addSubview:self.baseView];
    _baseView.frame = CGRectMake(100, 0, W, 40);
    CGFloat X = W/4;
    for (int i = 0; i<4; i++) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"测试";
        label.textAlignment = 1;
        label.font = [UIFont systemFontOfSize:13];
        label.textColor = TITLECOLOR;
        label.tag = 1+i;
        [_baseView addSubview:label];
        label.frame = CGRectMake(X*i, 10, X, 20);
    }
}
- (void)reloadViewLayout{
    CGFloat X = W/4;
    for (int i = 0; i<4; i++) {
        UILabel *label = (UILabel *)[_baseView viewWithTag:i+1];
        if (i == 0) {
            label.frame = CGRectMake(X*i-5, 10, X-20, 20);
        }else if (i == 1){
            label.frame = CGRectMake(X*i-20, 10, X-20, 20);
        }else if (i == 2){
            label.frame = CGRectMake(X*i-40, 10, X+20, 20);
        }else{
            label.frame = CGRectMake(X*i-20, 10, X+20, 20);
        }
        label.text = self.nameArray[i];
    }
    
}
- (void)layout{
    
}
- (UIView *)baseView{
    if (!_baseView) {
        UIView *view = [[UIView alloc]init];
        view.backgroundColor = [UIColor whiteColor];
        _baseView = view;
    }
    return _baseView;
}
- (void)drawRect:(CGRect)rect{
    UIBezierPath *path = [[UIBezierPath alloc]init];
    [path moveToPoint:CGPointMake(100, 39)];
    [path addLineToPoint:CGPointMake(W+100, 39)];
    [LINCOLOR set];
    [path stroke];
    UIBezierPath *pathLeft = [[UIBezierPath alloc]init];
    [pathLeft moveToPoint:CGPointMake(100, 0)];
    [pathLeft addLineToPoint:CGPointMake(100, 40)];
    [LINCOLOR set];
    [pathLeft stroke];
    UIBezierPath *pathRight = [[UIBezierPath alloc]init];
    [pathRight moveToPoint:CGPointMake(W+100, 0)];
    [pathRight addLineToPoint:CGPointMake(W+100, 40)];
    [LINCOLOR set];
    [pathRight stroke];
}
@end
